App({
  onLaunch: function (options) {
    // 登录
    var that = this
    wx.login({
      success: res => {
        if (res.code) {
          wx.request({ 
            url: that.globalData.url + 'accs/login',
            method: 'POST',
            data: {
              gh_id: 'gh_ad0a695269d4',
              code: res.code,
            },
            success: function (res) {
              that.globalData.openId = res.data.msg
              that.globalData.userId = res.data.data
            }
          })
        } else {
          console.log('登录失败' + res.errMsg)
        }
      }
    })
  },
  onShow: function (options) {
    this.globalData.referrerInfo = options.referrerInfo
  },
  globalData: {
    version: '1.2.1',
    gcwType: 'jjgcwkt',
    referrerInfo: null,
    userId: 0,
    openId: null,
    url: 'https://xcx.nanxuncn.com/api/gcw/second/',
    imageUrl: 'https://xcx.nanxuncn.com',
    globalFormIds: null
  }
})